Fix all compiler warnings with strict warning flags#641
Open
maxwbuckley wants to merge 1 commit intonmslib:masterfrom
Open
Fix all compiler warnings with strict warning flags#641maxwbuckley wants to merge 1 commit intonmslib:masterfrom
maxwbuckley wants to merge 1 commit intonmslib:masterfrom
Conversation
Enable strict compiler warnings and fix all issues found: Library headers: - Convert C-style casts to C++ casts (static_cast, reinterpret_cast, const_cast) - Fix const correctness in distance functions and data pointers - Mark unused parameters with /*name*/ syntax - Add missing override keywords on virtual functions - Fix shadow variable warnings - Fix sign comparison warnings (int vs size_t) - Add HNSWLIB_MAYBE_UNUSED macro for conditionally-used SIMD functions - Fix member initializer order in visited_list_pool.h Examples and tests: - Fix sign comparison warnings in loops - Mark unused lambda parameters - Fix shadow variables - Add missing override keywords Build infrastructure: - Update CMakeLists.txt with proper warning flags for GCC/Clang/MSVC - Add HNSWLIB_WERROR option to treat warnings as errors Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
HNSWLIB_WERRORCMake option to treat warnings as errorsChanges
Library headers:
static_cast,reinterpret_cast,const_cast)/*name*/syntaxoverridekeywords on virtual functionsHNSWLIB_MAYBE_UNUSEDmacro for conditionally-used SIMD functionsvisited_list_pool.hExamples and tests:
overridekeywordsBuild infrastructure:
HNSWLIB_WERRORoption to treat warnings as errorsNote
The
.github/workflows/build.ymlchange to enable-DHNSWLIB_WERROR=ONin CI could not be included in this PR due to GitHub token permissions. Maintainers may want to add this line to the build step:cmake .. -DHNSWLIB_WERROR=ONTest plan
searchKnnCloserFirst_test,epsilon_search_test,searchKnnWithFilter_test,multivector_search_test,multiThread_replace_test,multiThreadLoad_test)-DHNSWLIB_WERROR=ON(warnings as errors)🤖 Generated with Claude Code